﻿<!DOCTYPE html>
<html>
<head>
    <title>CGI</title>
</head>
<body>
    <h1>Our Page</h1>
    <script>
        //01
        //true coverted to number 1 & false to number 0

        if (true == 1)
            console.log('true');
        else
            console.log('false');

        if (false == 0)
            console.log('true');
        else
            console.log('false');


        //02
        /*
        if (42 == '42')
            console.log('true');
        else
            console.log('false');
        */

        //03
        /*
        var obj = {
            valueOf: function () { return 42; }
        }
        if (42 == obj)
            console.log('true');
        else
            console.log('false');

        var obj = {
            toString: function () { return 42; }
        }
        if (42 == obj)
            console.log('true');
        else
            console.log('false');
        */

        //04
        //each OBJ has it's own memory space
        /*
        var obj = {
            name: 'Trigger'
        };

        var obj2 = {
            name: 'Trigger'
        };

        if (obj == obj2)
            console.log('true');
        else
            console.log('false');

        var obj = {
            name: 'Trigger'
        };

        var obj2 = obj;
        if (obj == obj2)
            console.log('true');
        else
            console.log('false');
        */

        //05
        /*
        if (null == undefined)
            console.log('true');
        else
            console.log('false');

        if (undefined == 0)
            console.log('true');
        else
            console.log('false');

        if (null == 0)
            console.log('true');
        else
            console.log('false');

        if (NaN == NaN)
            console.log('true');
        else
            console.log('false');
        */

        //06
        //value and type both should same
        //comparing number with string
        /*
        if (55 === '55')
            console.log('true');
        else
            console.log('false');

        if (null === undefined)
            console.log('true');
        else
            console.log('false');
        */
    </script>
</body>
</html>